<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <title>Paster-by</title>

	<link rel="stylesheet" href="style.css" type="text/css" media="screen" /> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

    </head>

    <body>

    <div id="wrapper">

    <div id="header"> 

			<h1 class="vt-p">Pastebin</h1> 

			<div id="musicplayer" style="position:fixed;top:0px;right:20%"></div> 

		</div> 

    <div id="page" class="corners" align="center">

    	    <form method="post" action="submit.php" id="form" >

    	<?php

            require ( "xmlparser.php" );

            $xml_parser = new CXmlParser ();

            $document = $xml_parser->parse ( "rules.xml" );

        ?>
        
        <div align="left"><h3>Title:</h3></div>
        
        <input name="input_title" class="smallinput">

	    <div align="left"><h3>Enter text here:</h3></div>

            <textarea name="input_text" class="smallinput" rows="25" cols="70"></textarea>

            <br />

            <div align="center"><h3>Select language:

            <select name="input_language">

            <?php

                var_dump ( $document );

                for ( $i = 0; $i < count ( $document ['RULE'] ); $i++ ) {

                    print ( "<option value=\"" . $i . "\">" );

                    print ( $document ['RULE'][$i]['attributes']['NAME'] );

                    print ( "</option>" );

                }

            ?>
</select>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="input_public">Private</input><br></h3></div><br /><br />

            <button type="submit" class="smallinput">submit</button>
	    </form>
	<div style="margin:20px 0;" align="center"><img src="../line.png"></div>
     <div align="left"> 
           <table class="recent">
        <thead><tr> 
          <!-- <th class="recentnum">#</th> --> 
         <th class="recenttitle">Title</th> 
          <th class="recenttype">Type</th> 
          <th class="recentdate">Date</th> 
        </tr></thead>
        <tbody>  
        	<?php
			require ( "database.php" );
			database_connect ();
			$xml_parser = new CXmlParser;
			$rules = $xml_parser->parse ( "rules.xml" );
			$num=database_entries ();
			for($i=0;$i<$num;$i++)
			{
				 $array= database_retrieve_id ( $i );
				 if ($array['Public']==1)
					 continue;
				 echo ( "<tr> \n");
				 //echo ( "<td class='recentnum'>" . $i . "</td> \n");
				 echo ( "<td  class='recenttitle'><a href=" . $array['Link'] . ">" . $array['Title'] . "</a></td>\n");
				 echo ( "<td class='recenttype'>".$rules ['RULE'][$array['Language']]['attributes']['NAME']."</td>\n");
				 echo ( "<td class='recentdate'>" . $array['Date']);
				 
			}
        ?>
        </tbody> 
     </table>
     </div> 
         <div align="right">
      Code by <a href="http://sourceforge.net/projects/openpastebin/" target="_blank">OpenPaste</a>
      Edit by <a href="http://www.fanhe.org/" target="_blank">fanzeyi</a>
      Design by <a href="http://anegie.com/" target="_blank">Kevin Deng</a>
  </div>
	</div>
    
    <div>&nbsp;<br />&nbsp;<br /></div>

	</div>

    </body>

</html>

